<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>组件注册</title>
</head>
<body>
<div id="app">
    <button-conunter></button-conunter>
    <button-conunter></button-conunter>
    <button-conunter></button-conunter>
</div>

<!-- 生产环境版本，优化了尺寸和速度 -->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="text/javascript">
    /*
    组件注册
     */
    Vue.component("button-conunter", {
        data: function () {
            return {
                count: 0
            }
        },
        template: "<button @click='handle'>你点击了我{{count}}次</button>",
        methods: {
            handle: function () {
                this.count += 2;
            }
        }
    })

    var vue = new Vue({
        el: "#app",

    })
</script>
</body>
</html>
